<?php

namespace App\Http\Controllers\Web;

use App\Http\Controllers\Controller;
use App\Http\Service\AreaService;
use App\Http\Service\RegionService;

class IndexController extends Controller {

    public function area() {
        try {
            $data = AreaService::area();
            return response()->json(['code' => 200, 'msg' => '成功', 'data' => $data]);
        } catch (\Exception $e) {
            return response()->json(['code' => 201, 'msg' => $e->getFile() . $e->getLine() . $e->getMessage()]);
        }
    }

    public function region() {
        try {
            $data = RegionService::region();
            return response()->json(['code' => 200, 'msg' => '成功', 'data' => $data]);
        } catch (\Exception $e) {
            return response()->json(['code' => 201, 'msg' => $e->getMessage()]);
        }
    }

}
